package net.sx.minemodule.mvp.bean;

import com.kedll.library.adapter.MultiTypeAdapter;
import com.kedll.library.mvp.BaseModel;

import net.sx.minemodule.mvp.item.RefundDetailGoodsItem;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * Created by 拇指 on 2019/7/8 0008.
 * Email:muzhi@uoko.com
 * 售后订单商品信息
 * {@link AfterGoodsBean}在今后列表及详情中已不再使用，但在申请售后等页面中还是使用，帮保留
 */
public class RefundGoodsBean extends BaseModel<RefundDetailGoodsItem> implements Serializable {
    /**
     * attrs : [{"name":"","value":""}]
     * id : 0
     * num : 0
     * pic :
     * productId : 0
     * productName :
     * salePrice : 0
     */

    private int id;
    private int num;
    private String pic;
    private int productId;
    private String productName;
    private BigDecimal salePrice;
    private List<AttrsBean> attrs;
    //售后详情商品返还信息
    private int point;//": 0,
    private BigDecimal commission;//": 0,

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    public BigDecimal getCommission() {
        return commission;
    }

    public void setCommission(BigDecimal commission) {
        this.commission = commission;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public int getProductId() {
        return productId;
    }

    public void setProductId(int productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public BigDecimal getSalePrice() {
        if (salePrice == null) {
            salePrice = new BigDecimal(0);
        }
        return salePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
    }

    public void setSalePrice(BigDecimal salePrice) {
        this.salePrice = salePrice;
    }

    public List<AttrsBean> getAttrs() {
        return attrs;
    }

    public void setAttrs(List<AttrsBean> attrs) {
        this.attrs = attrs;
    }

    public static class AttrsBean implements Serializable {
        /**
         * name :
         * value :
         */

        private String name;
        private String value;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }

    @Override
    public RefundDetailGoodsItem createItem(MultiTypeAdapter adapter) {
        return new RefundDetailGoodsItem(this);
    }

}
